<template>
    <div>
        <!-- 面包屑 -->
        <el-bread></el-bread>
        <el-button type="primary" plain @click="add">添加</el-button>
        <!-- 表格 -->
        <list @edit="edit"></list>
        <!-- 弹窗 -->
        <dia-log ref="dialogRef" :isShow="isShow" :isAdd="isAdd" @cancel="cancel"></dia-log>
    </div>
</template>
<script>
import list from './list.vue'
import diaLog from './dialog.vue';
export default {
    data() {
        return {
            isShow: false,//弹窗状态
            isAdd: true,//是否为添加
        }
    },
    methods: {
        // 点击添加  弹出弹窗
        add() {
            this.isShow = true;
            this.isAdd = true;
        },
        // 关闭弹窗
        cancel() {
            this.isShow = false;
            this.isAdd = true;
        },
        // 修改
        edit(id){
            // 弹出弹窗
            this.isShow = true;
            this.isAdd = false;
            // 数据回显
            this.$refs.dialogRef.lookup(id);
        }
    },
    mounted() { },
    watch: {},
    computed: {},
    filters: {},
    components: {
        list,
        diaLog
    },
}
</script>
<style scoped>
.el-button {
    margin: 20px 0 10px;
}
</style>